package create_创建型.build_facory_建造模式;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: hihi
 * @Date: 2020/07/03/15:34
 * @Description:
 */
public class Meal {
	private List<Item> items = new ArrayList<>();

	public void add(Item item) {
		items.add(item);
	}

	public double getCost() {
		return items.stream().mapToDouble(Item::price).sum();
	}

	public void show() {
		for (Item item : items) {
			System.err.println(item);
		}
	}
}
